package com.fund.api;

import com.fund.dao.UserDao;
import com.fund.domain.User;
import com.github.pagehelper.PageHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by GPL on 2017/8/4.
 */
@RestController
@RequestMapping(value = "/user", produces = "application/json;charset=utf-8")
public class TestApi {
    Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired(required = false)
    private UserDao userDao;

    @RequestMapping(value = { "/list" }, method = { RequestMethod.GET, RequestMethod.POST })
    public void test(User user) {
        PageHelper.startPage(1,5);
        List<User> list = userDao.listAll(user);
        for (User u : list) {
            logger.info(u.getName());
        }
        //PageHelper.clearPage();
    }
}
